package factory;

import factory.service.Shape;
import factory.service.impl.Circle;
import factory.service.impl.Square;

//工厂类
public class ShapeFactory {
    //获取形状类型的对象
    public Shape getShap(String shapeType){
        if (shapeType==null){
            return null;
        }else if (shapeType.equalsIgnoreCase("circle")){
            return new Circle();
        } else if (shapeType.equalsIgnoreCase("square")) {
            return new Square();
        }
        return null;
    }

}
